//
//  MRTHomeViewController.m
//  兼职页面
//
//  Created by kuiyuan liang on 2021/5/28.
//

#import "MRTHomeViewController.h"
#import "CommonUtil.h"
#import "TypeControlView.h"

@interface MRTHomeViewController ()
@property (strong, nonatomic) UIImageView * bgImageView;
@property (strong, nonatomic) UIView * whiteView;
@property (strong, nonatomic) UIButton * cancelBtn;
@end

@implementation MRTHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.bgImageView];
    [self.view addSubview:self.whiteView];
}



- (void)gangcaiClick:(UIControl *)sender{
    NSLog(@"港彩");
}

- (void)aocaiClick:(UIControl *)sender{
    NSLog(@"澳彩");
}
- (void)cancelBtnClick:(UIControl *)sender{
    [self dismissViewControllerAnimated:YES completion:nil];
}

-(UIImageView *)bgImageView{
    if (!_bgImageView) {
        _bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, AD(350))];
        _bgImageView.image = [UIImage imageNamed:@"bg_home_mingren"];
    }
    return _bgImageView;
}


-(UIView *)whiteView{
    if (!_whiteView) {
        CGFloat wh = SCREEN_HEIGHT-_bgImageView.height;
        _whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-wh, SCREEN_WIDTH,wh)];
        _whiteView.backgroundColor = RGB(255.0, 255.0, 255.0);
       
        
        CGFloat margin = AD(40);
        CGFloat w = (SCREEN_WIDTH-(margin*3))/2;
        CGFloat h = w * 0.75;
        
        UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(margin, AD(60), w, h)];
        view1.backgroundColor = [UIColor whiteColor];
        view1.layer.cornerRadius = AD(5);
        view1.layer.shadowColor = [UIColor blackColor].CGColor;
        view1.layer.shadowRadius= AD(3);
        view1.layer.shadowOpacity = 0.1f;
        view1.layer.shadowOffset = CGSizeMake(0,0);
        [_whiteView addSubview:view1];
        
        TypeControlView *hongkongControl = [[TypeControlView alloc] initWithFrame:CGRectMake(0, 0, w, h)];
        hongkongControl.type = @"港彩";
        [view1 addSubview:hongkongControl];
        [hongkongControl addTarget:self action:@selector(gangcaiClick:) forControlEvents:UIControlEventTouchUpInside];

        UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(view1.right + AD(40), AD(60), w, h)];
        view2.backgroundColor = [UIColor whiteColor];
        view2.layer.cornerRadius = AD(5);
        view2.layer.shadowColor = [UIColor blackColor].CGColor;
        view2.layer.shadowRadius= AD(3);
        view2.layer.shadowOpacity = 0.1f;
        view2.layer.shadowOffset = CGSizeMake(0,0);
        [_whiteView addSubview:view2];
        
        
        TypeControlView *aocaiControl = [[TypeControlView alloc] initWithFrame:CGRectMake(0, 0, w, h)];
        aocaiControl.type = @"澳彩";
        [view2 addSubview:aocaiControl];
        [aocaiControl addTarget:self action:@selector(aocaiClick:) forControlEvents:UIControlEventTouchUpInside];
        
        UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [cancelBtn addTarget:self action:@selector(cancelBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        cancelBtn.frame = CGRectMake(0, _whiteView.height-AD(120), AD(25), AD(25));
        cancelBtn.centerX = SCREEN_WIDTH/2;
        [cancelBtn setImage:[UIImage imageNamed:@"icon_chacha"] forState:UIControlStateNormal];
        [cancelBtn setImage:[UIImage imageNamed:@"icon_chacha"] forState:UIControlStateHighlighted];
        [_whiteView addSubview:cancelBtn];
        
    }
    return _whiteView;
}




@end
